#include "CSerialPort.h"
#include "Tracker.h"
#include <opencv2/videoio.hpp>
#include <opencv2/opencv.hpp>
#include <iostream>
#include <iomanip>
using namespace std;
using namespace cv;


vector<Point2f> center;

int main(int argc, char **argv)
{
	CommandLineParser parser(argc, argv, "{@input_path |0|input path can be a camera id, like 0,1,2 or a video filename}");
	parser.printMessage();
	string input_path = parser.get<string>(0);
	string video_name = input_path;
	VideoCapture video_in;
	Mat frame;

	video_in.set(CV_CAP_PROP_FRAME_WIDTH,640);
        video_in.set(CV_CAP_PROP_FRAME_HEIGHT,480);	

	int  iFrameHeight = video_in.get(CV_CAP_PROP_FRAME_HEIGHT);  
        int  iFrameWidth  = video_in.get(CV_CAP_PROP_FRAME_WIDTH);  
	while(1)
	{
	if ((isdigit(input_path[0]) && input_path.size() == 1))
	{
		int camera_no = input_path[0] - '0';
		video_in.open(camera_no);
	}
	else
	{
		video_in.open(video_name);
	}
	if (!video_in.isOpened())
	{
		cerr << "Couldn't open " << video_name << endl;
		return 1;
	}
			video_in >> frame;
	namedWindow("123");

	cout<<iFrameHeight<<"   "<<iFrameWidth<<endl;
	imshow("123",frame);
	waitKey(1);

	}
	return 0;
}
